<head>
    <title>Simple Demo (Without Web Workers)</title>
    <meta http-equive="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>This is a very simple demonstration of <a href="http://github.com/nmrugg/LZMA-JS/">LZMA-JS</a>,
a browser-based implementation of the LZMA compression algorithm without the use of Web Workers.</p>

<textarea spellcheck=false id=compression_el>Hello, world.</textarea><br>
<button id=go>Go</button>
<script src="../src/lzma_worker.js"></script>
<script>

var compression_mode = 1,
    my_lzma = LZMA; /// lzma_worker.js creates a global LZMA object. We store it as a new variable just to match simple_demo.html.

document.getElementById("go").onclick = function () {
    /// First, let's compress it.
    my_lzma.compress(document.getElementById("compression_el").value, compression_mode, function on_compress_complete(result) {
        alert("Compressed: " + result);
        
        /// Now, let's try to decompress it to make sure it works both ways.
        my_lzma.decompress(result, function on_decompress_complete(result) {
            alert("Decompressed: " + result);
        }, function on_decompress_progress_update(percent) {
            /// Decompressing progress code goes here.
            document.title = "Decompressing: " + (percent * 100) + "%";
        });
    }, function on_compress_progress_update(percent) {
        /// Compressing progress code goes here.
        document.title = "Compressing: " + (percent * 100) + "%";
    });
}

</script>
</body>